package com.rc.mutievcharger.dto.ylevcharger.terminal.req;

import com.rc.evcharger.common.annotation.ByteLength;
import com.rc.evcharger.common.base.yl.BaseYlCommand;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;

/**
 * Create by Yang on 2021/4/26
 * <p>
 * （CMD=1102）充电桩应答后台服务器设置 24 时电费计价策略
 */
public class YlPriceConfiremCommandReq extends BaseYlCommand {

    @ByteLength(length = 1)
    private BigDecimal beginHour1;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute1;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour1;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute1;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio1;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour2;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute2;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour2;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute2;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio2;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour3;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute3;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour3;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute3;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio3;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour4;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute4;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour4;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute4;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio4;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour5;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute5;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour5;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute5;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio5;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour6;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute6;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour6;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute6;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio6;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour7;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute7;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour7;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute7;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio7;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour8;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute8;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour8;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute8;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio8;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour9;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute9;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour9;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute9;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio9;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour10;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute10;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour10;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute10;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio10;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour11;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute11;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour11;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute11;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio11;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    @ByteLength(length = 1)
    private BigDecimal beginHour12;//开始小时     0~24
    @ByteLength(length = 1)
    private BigDecimal beginMinute12;//开始分钟     0 或 30
    @ByteLength(length = 1)
    private BigDecimal endHour12;//结束小时        0~24
    @ByteLength(length = 1)
    private BigDecimal endMinute12;//结束分钟       0 或 30
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal priceRatio12;//费率 1 该时段内每度电的电费，用整型值表示，要乘 0.01才能得到真实的值

    public BigDecimal getBeginHour1() {
        return beginHour1;
    }

    public void setBeginHour1(BigDecimal beginHour1) {
        this.beginHour1 = beginHour1;
    }

    public BigDecimal getBeginMinute1() {
        return beginMinute1;
    }

    public void setBeginMinute1(BigDecimal beginMinute1) {
        this.beginMinute1 = beginMinute1;
    }

    public BigDecimal getEndHour1() {
        return endHour1;
    }

    public void setEndHour1(BigDecimal endHour1) {
        this.endHour1 = endHour1;
    }

    public BigDecimal getEndMinute1() {
        return endMinute1;
    }

    public void setEndMinute1(BigDecimal endMinute1) {
        this.endMinute1 = endMinute1;
    }

    public BigDecimal getPriceRatio1() {
        return priceRatio1;
    }

    public void setPriceRatio1(BigDecimal priceRatio1) {
        this.priceRatio1 = priceRatio1;
    }

    public BigDecimal getBeginHour2() {
        return beginHour2;
    }

    public void setBeginHour2(BigDecimal beginHour2) {
        this.beginHour2 = beginHour2;
    }

    public BigDecimal getBeginMinute2() {
        return beginMinute2;
    }

    public void setBeginMinute2(BigDecimal beginMinute2) {
        this.beginMinute2 = beginMinute2;
    }

    public BigDecimal getEndHour2() {
        return endHour2;
    }

    public void setEndHour2(BigDecimal endHour2) {
        this.endHour2 = endHour2;
    }

    public BigDecimal getEndMinute2() {
        return endMinute2;
    }

    public void setEndMinute2(BigDecimal endMinute2) {
        this.endMinute2 = endMinute2;
    }

    public BigDecimal getPriceRatio2() {
        return priceRatio2;
    }

    public void setPriceRatio2(BigDecimal priceRatio2) {
        this.priceRatio2 = priceRatio2;
    }

    public BigDecimal getBeginHour3() {
        return beginHour3;
    }

    public void setBeginHour3(BigDecimal beginHour3) {
        this.beginHour3 = beginHour3;
    }

    public BigDecimal getBeginMinute3() {
        return beginMinute3;
    }

    public void setBeginMinute3(BigDecimal beginMinute3) {
        this.beginMinute3 = beginMinute3;
    }

    public BigDecimal getEndHour3() {
        return endHour3;
    }

    public void setEndHour3(BigDecimal endHour3) {
        this.endHour3 = endHour3;
    }

    public BigDecimal getEndMinute3() {
        return endMinute3;
    }

    public void setEndMinute3(BigDecimal endMinute3) {
        this.endMinute3 = endMinute3;
    }

    public BigDecimal getPriceRatio3() {
        return priceRatio3;
    }

    public void setPriceRatio3(BigDecimal priceRatio3) {
        this.priceRatio3 = priceRatio3;
    }

    public BigDecimal getBeginHour4() {
        return beginHour4;
    }

    public void setBeginHour4(BigDecimal beginHour4) {
        this.beginHour4 = beginHour4;
    }

    public BigDecimal getBeginMinute4() {
        return beginMinute4;
    }

    public void setBeginMinute4(BigDecimal beginMinute4) {
        this.beginMinute4 = beginMinute4;
    }

    public BigDecimal getEndHour4() {
        return endHour4;
    }

    public void setEndHour4(BigDecimal endHour4) {
        this.endHour4 = endHour4;
    }

    public BigDecimal getEndMinute4() {
        return endMinute4;
    }

    public void setEndMinute4(BigDecimal endMinute4) {
        this.endMinute4 = endMinute4;
    }

    public BigDecimal getPriceRatio4() {
        return priceRatio4;
    }

    public void setPriceRatio4(BigDecimal priceRatio4) {
        this.priceRatio4 = priceRatio4;
    }

    public BigDecimal getBeginHour5() {
        return beginHour5;
    }

    public void setBeginHour5(BigDecimal beginHour5) {
        this.beginHour5 = beginHour5;
    }

    public BigDecimal getBeginMinute5() {
        return beginMinute5;
    }

    public void setBeginMinute5(BigDecimal beginMinute5) {
        this.beginMinute5 = beginMinute5;
    }

    public BigDecimal getEndHour5() {
        return endHour5;
    }

    public void setEndHour5(BigDecimal endHour5) {
        this.endHour5 = endHour5;
    }

    public BigDecimal getEndMinute5() {
        return endMinute5;
    }

    public void setEndMinute5(BigDecimal endMinute5) {
        this.endMinute5 = endMinute5;
    }

    public BigDecimal getPriceRatio5() {
        return priceRatio5;
    }

    public void setPriceRatio5(BigDecimal priceRatio5) {
        this.priceRatio5 = priceRatio5;
    }

    public BigDecimal getBeginHour6() {
        return beginHour6;
    }

    public void setBeginHour6(BigDecimal beginHour6) {
        this.beginHour6 = beginHour6;
    }

    public BigDecimal getBeginMinute6() {
        return beginMinute6;
    }

    public void setBeginMinute6(BigDecimal beginMinute6) {
        this.beginMinute6 = beginMinute6;
    }

    public BigDecimal getEndHour6() {
        return endHour6;
    }

    public void setEndHour6(BigDecimal endHour6) {
        this.endHour6 = endHour6;
    }

    public BigDecimal getEndMinute6() {
        return endMinute6;
    }

    public void setEndMinute6(BigDecimal endMinute6) {
        this.endMinute6 = endMinute6;
    }

    public BigDecimal getPriceRatio6() {
        return priceRatio6;
    }

    public void setPriceRatio6(BigDecimal priceRatio6) {
        this.priceRatio6 = priceRatio6;
    }

    public BigDecimal getBeginHour7() {
        return beginHour7;
    }

    public void setBeginHour7(BigDecimal beginHour7) {
        this.beginHour7 = beginHour7;
    }

    public BigDecimal getBeginMinute7() {
        return beginMinute7;
    }

    public void setBeginMinute7(BigDecimal beginMinute7) {
        this.beginMinute7 = beginMinute7;
    }

    public BigDecimal getEndHour7() {
        return endHour7;
    }

    public void setEndHour7(BigDecimal endHour7) {
        this.endHour7 = endHour7;
    }

    public BigDecimal getEndMinute7() {
        return endMinute7;
    }

    public void setEndMinute7(BigDecimal endMinute7) {
        this.endMinute7 = endMinute7;
    }

    public BigDecimal getPriceRatio7() {
        return priceRatio7;
    }

    public void setPriceRatio7(BigDecimal priceRatio7) {
        this.priceRatio7 = priceRatio7;
    }

    public BigDecimal getBeginHour8() {
        return beginHour8;
    }

    public void setBeginHour8(BigDecimal beginHour8) {
        this.beginHour8 = beginHour8;
    }

    public BigDecimal getBeginMinute8() {
        return beginMinute8;
    }

    public void setBeginMinute8(BigDecimal beginMinute8) {
        this.beginMinute8 = beginMinute8;
    }

    public BigDecimal getEndHour8() {
        return endHour8;
    }

    public void setEndHour8(BigDecimal endHour8) {
        this.endHour8 = endHour8;
    }

    public BigDecimal getEndMinute8() {
        return endMinute8;
    }

    public void setEndMinute8(BigDecimal endMinute8) {
        this.endMinute8 = endMinute8;
    }

    public BigDecimal getPriceRatio8() {
        return priceRatio8;
    }

    public void setPriceRatio8(BigDecimal priceRatio8) {
        this.priceRatio8 = priceRatio8;
    }

    public BigDecimal getBeginHour9() {
        return beginHour9;
    }

    public void setBeginHour9(BigDecimal beginHour9) {
        this.beginHour9 = beginHour9;
    }

    public BigDecimal getBeginMinute9() {
        return beginMinute9;
    }

    public void setBeginMinute9(BigDecimal beginMinute9) {
        this.beginMinute9 = beginMinute9;
    }

    public BigDecimal getEndHour9() {
        return endHour9;
    }

    public void setEndHour9(BigDecimal endHour9) {
        this.endHour9 = endHour9;
    }

    public BigDecimal getEndMinute9() {
        return endMinute9;
    }

    public void setEndMinute9(BigDecimal endMinute9) {
        this.endMinute9 = endMinute9;
    }

    public BigDecimal getPriceRatio9() {
        return priceRatio9;
    }

    public void setPriceRatio9(BigDecimal priceRatio9) {
        this.priceRatio9 = priceRatio9;
    }

    public BigDecimal getBeginHour10() {
        return beginHour10;
    }

    public void setBeginHour10(BigDecimal beginHour10) {
        this.beginHour10 = beginHour10;
    }

    public BigDecimal getBeginMinute10() {
        return beginMinute10;
    }

    public void setBeginMinute10(BigDecimal beginMinute10) {
        this.beginMinute10 = beginMinute10;
    }

    public BigDecimal getEndHour10() {
        return endHour10;
    }

    public void setEndHour10(BigDecimal endHour10) {
        this.endHour10 = endHour10;
    }

    public BigDecimal getEndMinute10() {
        return endMinute10;
    }

    public void setEndMinute10(BigDecimal endMinute10) {
        this.endMinute10 = endMinute10;
    }

    public BigDecimal getPriceRatio10() {
        return priceRatio10;
    }

    public void setPriceRatio10(BigDecimal priceRatio10) {
        this.priceRatio10 = priceRatio10;
    }

    public BigDecimal getBeginHour11() {
        return beginHour11;
    }

    public void setBeginHour11(BigDecimal beginHour11) {
        this.beginHour11 = beginHour11;
    }

    public BigDecimal getBeginMinute11() {
        return beginMinute11;
    }

    public void setBeginMinute11(BigDecimal beginMinute11) {
        this.beginMinute11 = beginMinute11;
    }

    public BigDecimal getEndHour11() {
        return endHour11;
    }

    public void setEndHour11(BigDecimal endHour11) {
        this.endHour11 = endHour11;
    }

    public BigDecimal getEndMinute11() {
        return endMinute11;
    }

    public void setEndMinute11(BigDecimal endMinute11) {
        this.endMinute11 = endMinute11;
    }

    public BigDecimal getPriceRatio11() {
        return priceRatio11;
    }

    public void setPriceRatio11(BigDecimal priceRatio11) {
        this.priceRatio11 = priceRatio11;
    }

    public BigDecimal getBeginHour12() {
        return beginHour12;
    }

    public void setBeginHour12(BigDecimal beginHour12) {
        this.beginHour12 = beginHour12;
    }

    public BigDecimal getBeginMinute12() {
        return beginMinute12;
    }

    public void setBeginMinute12(BigDecimal beginMinute12) {
        this.beginMinute12 = beginMinute12;
    }

    public BigDecimal getEndHour12() {
        return endHour12;
    }

    public void setEndHour12(BigDecimal endHour12) {
        this.endHour12 = endHour12;
    }

    public BigDecimal getEndMinute12() {
        return endMinute12;
    }

    public void setEndMinute12(BigDecimal endMinute12) {
        this.endMinute12 = endMinute12;
    }

    public BigDecimal getPriceRatio12() {
        return priceRatio12;
    }

    public void setPriceRatio12(BigDecimal priceRatio12) {
        this.priceRatio12 = priceRatio12;
    }

    public static void main(String[] args) {
        YlPriceConfiremCommandReq result = (YlPriceConfiremCommandReq) new YlPriceConfiremCommandReq();
        result.setBeginHour1(new BigDecimal("01"));
        result.setBeginMinute1(new BigDecimal("00"));
        result.setEndHour1(new BigDecimal("12"));
        result.setEndMinute1(new BigDecimal("00"));
        result.setBeginHour2(new BigDecimal("12"));
        result.setBeginMinute2(new BigDecimal("00"));
        result.setEndHour2(new BigDecimal("24"));
        result.setEndMinute2(new BigDecimal("00"));
        result.setPriceRatio1(new BigDecimal("1.51"));
        result.setPriceRatio1(new BigDecimal("2.01"));

        Class<? extends YlPriceConfiremCommandReq> aClass = result.getClass();

        Field[] declaredFields = aClass.getDeclaredFields();
        for (Field field : declaredFields) {
            // 如果类型是String
            if (field.getGenericType().toString().equals(
                    "class java.math.BigDecimal")) { // 如果type是类类型，则前面包含"class "，后面跟类名


                //首字母转大写
                byte[] items = field.getName().getBytes();
                items[0] = (byte) ((char) items[0] - 'a' + 'A');

                // 拿到该属性的gettet方法
                Method m = null;
                try {
                    m = result.getClass().getMethod(
                            "get" + new String(items));
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
                // 拿到该属性的gettet方法
                BigDecimal val = null;// 调用getter方法获取属性值
                try {
                    val = (BigDecimal) m.invoke(result);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                }
                if (val != null) {
                    System.out.println("BigDecimal type:" + (val.toString().length() == 1 ? "0" + val : val.toString()));
                }
            }
        }
    }
}
